package com.huike.web.controller.report;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huike.common.core.domain.AjaxResult;
import com.huike.report.service.IReportService;

import java.text.ParseException;

@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IReportService reportService;


    /**
     * 首页--基础数据统计
     */
    @GetMapping("/getBaseInfo")
    public AjaxResult getBaseInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime){
        return AjaxResult.success(reportService.getBaseInfo(beginCreateTime,endCreateTime));
    }

    /**
     * 线索数量，商机、合同、成交金额的首页展示请求
     */
    @GetMapping("/getTodayInfo")
    public AjaxResult getTodayInfo() throws ParseException {
        return AjaxResult.success("查询成功",reportService.getTodayInfo());
    }

    /**
     * 首页--待办数据统计接口
     */
    @GetMapping("/getTodoInfo")
    public AjaxResult getTodoInfo(String beginCreateTime ,String endCreateTime){
        System.out.println("收到的开始日期是"+beginCreateTime);
        System.out.println("收到的结束日期是"+endCreateTime);
        return AjaxResult.success(reportService.getTodoInfo(beginCreateTime,endCreateTime));
    }

}